<!doctype html>
<html>
<head>
	<title>PINCODE验证</title>
	<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
</head>
<body>
<div>
	{{ Form::open(array('url'=>'/api/fromPc','method'=>'post','id' => 'form-add-api')); }}
		{{ Form::label('code', 'PINCODE:'); }}
		{{ Form::text('code','A02b2650n6DV5') }}

		{{ Form::submit('提交'); }}
	{{  Form::close(); }}
   <!--  {{ Form::open(array('url'=>'/api/savePinU','method'=>'post','id' => 'form-save-api')); }}
        {{ Form::label('code', 'PINCODE:'); }}
        {{ Form::text('code','A02b2650n6DV5') }}

        {{ Form::label('Pincode', 'PINCODE:'); }}
        {{ Form::selectMonth('code'); }} 

        {{ Form::submit('提交'); }}
    {{  Form::close(); }} -->
</div>
<script>
// var root_url = "<?php echo Request::root(); ?>/"; // put this in php file
jQuery( document ).ready( function( $ ) {
 
    $( '#form-add-api' ).on( 'submit', function() {
 
        $.post(
            $( this ).prop( 'action' ),
            {
                "_token": $( this ).find( 'input[name=_token]' ).val(),
                "code": $( '#code' ).val()
            },
            function( data ) {
            	alert(data);
                //do something with data/response returned by server
            },
            'json'
        );
 
       
        return false;
    } );
    $( '#form-save-api' ).on( 'submit', function() {
 
        $.post(
            $( this ).prop( 'action' ),
            {
                "_token": $( this ).find( 'input[name=_token]' ).val(),
                "code": $( '#code' ).val()
            },
            function( data ) {
                alert(data);
                //do something with data/response returned by server
            },
            'json'
        );
 
        return false;
    } );
 
} );
</script>
</body>